<template>
  <van-field
    :required="required"
    :type="type"
    :readonly="readonly"
    :disabled="disabled"
    :rules="rules"
    :row="row"
    autosize
    v-model="value"
    @change="setData"
    :placeholder="placeholder ? placeholder : '请填写' + title"
  />
</template>
<script>
export default {
  name: "FormVantInput",
  props: {
    value: {
      type: String,
      default: ""
    },
    title: {
      type: String,
      default: "文本"
    },
    disabled: {
      type: Boolean,
      default: false
    },
    type: {
      type: String,
      default: "textarea"
    },
    placeholder: {
      type: String,
      default: ""
    },
    rules: {
      type: Array,
      default: () => []
    },
    row: {
      type: Number,
      default: 1
    },
    readonly: {
      type: Boolean,
      default: false
    },
    required: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    value(v) {
      //   this.$emit("input", v);
    }
  },
  mounted() {},
  methods: {
    setData() {
      this.$emit("input", this.value);
    }
  }
};
</script>
